﻿$(document).ready(function () {

    $.ajax(
    {
        url: "/Service/GetList",
        data: {},
        success: function (data) {
            var result = data;
            var str = " <img style=\"width: 100px\" src=\"{0}\"></img><br /><a href=\"PreviewService?id={4}\" style=\"text-decoration:none\"><h4 style=\"font-family:黑体\; color:#5781ec\">{1}</h4></a><span>{2} </span><br /><a href=\"PreviewService?id={3}\"><span style=\"color: Gray; font-size:1.2em; text-decoration: underline\">> More <</span><br/></a><br /><a class=\"back-top\" href=\"#top\">跳到顶部</a><br/><br/>";
            var ul = document.createElement("ul");

            $(result).each(function () {
                var temp = this;
                var li = document.createElement("li");
                var h = str.replace("{0}", temp.Img).replace("{0}", temp.Img).replace("{1}", temp.Title).replace("{2}", temp.Preview).replace("{3}", temp.ID).replace("{4}", temp.ID);
                $(li).html(h);
                $(ul).html($(ul).html() + li.outerHTML);
            });
            $("#ContentHolder").html(ul.outerHTML);
        },
        error: function (jqHR) {
            alert("数据读取错误");
        }
    }
    );
});
